# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Chih-Hsuan Yen <yan12125@archlinux.org>

pkgname=python-sure
pkgver=2.0.1
_commit=84a45bf91fde2e4b922fb126a9f45651be9393fb
pkgrel=3
pkgdesc="An idiomatic testing library for python with powerful and flexible assertions"
arch=('any')
url="https://github.com/gabrielfalcao/sure"
license=('GPL')
depends=('python-six')
makedepends=('python-setuptools' 'git')
# python-nose is still imported in some tests https://github.com/gabrielfalcao/sure/issues/182
checkdepends=('python-pytest' 'python-nose')
source=("git+https://github.com/gabrielfalcao/sure.git#commit=$_commit"
        "use-unittest-mock.diff")
sha512sums=('SKIP'
            'ad17f0bc171058cc488f844a55bd0cf2f83b391c6c47b4ac1864b5de0d0842eb086dd1413c249a05684a45c67542c15eadfa2a7cdff095669e327d0e80f09183')

prepare() {
  export LC_CTYPE=en_US.UTF-8

  cd sure
  # Based on the first two commits in https://github.com/gabrielfalcao/sure/pull/161
  patch -Np1 -i ../use-unittest-mock.diff

  sed -i 's#--cov=sure##' setup.cfg
}

build() {
  cd sure
  python setup.py build
}

check() {
  cd sure
  PYTHONPATH="$PWD" pytest
}

package() {
  cd sure
  python setup.py install --root="$pkgdir" --optimize=1
}
